//
//  QuestionSectionView.m
//  DanaKreditLoan
//
//  Created by ZhengChengFeng on 2024/10/19.
//

#import "QuestionSectionView.h"

@implementation QuestionSectionView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        self.backV = [[UIView alloc] init];
        self.backV.backgroundColor = kTableViewBackColor;
        [self addSubview:self.backV];
        [self.backV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left);
            make.right.equalTo(self.mas_right);
            make.top.equalTo(self.mas_top);
            make.bottom.equalTo(self.mas_bottom);
        }];
        self.backV.layer.cornerRadius = 14;
        self.backV.layer.masksToBounds = YES;
        
        self.topBackV = [[UIView alloc] init];
        self.topBackV.backgroundColor = [UIColor clearColor];
        [self addSubview:self.topBackV];
        [self.topBackV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left);
            make.right.equalTo(self.mas_right);
            make.top.equalTo(self.mas_top);
            make.height.equalTo(@15);
        }];
        
        self.whiteV = [[UIView alloc] init];
        [self.backV addSubview:self.whiteV];
        self.whiteV.backgroundColor = [UIColor whiteColor];
        [self.whiteV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.backV.mas_left).offset(15);
            make.right.equalTo(self.backV.mas_right).offset(-15);
            make.top.equalTo(self.backV.mas_top).offset(15);
            make.bottom.equalTo(self.backV.mas_bottom);
        }];
        
        self.whiteV.layer.cornerRadius = 18;
        self.whiteV.layer.masksToBounds = YES;
        
        self.botWhiteV = [[UIView alloc] init];
        self.botWhiteV.backgroundColor = [UIColor whiteColor];
        [self.backV addSubview:self.botWhiteV];
        [self.botWhiteV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.backV.mas_left).offset(15);
            make.right.equalTo(self.backV.mas_right).offset(-15);
            make.height.equalTo(@20);
            make.bottom.equalTo(self.backV.mas_bottom);
        }];
        
        self.iconV = [[UIImageView alloc] init];
        [self.backV addSubview:self.iconV];
        [self.iconV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.whiteV.mas_right);
            make.top.equalTo(self.whiteV.mas_top);
            make.width.equalTo(@36);
            make.height.equalTo(@27);
        }];
        
        self.titleLab = [UILabel createLabel:[UIFont fontWithName:kFuturaBold size:14] color:kBlackColor];
        [self.whiteV addSubview:self.titleLab];
        self.titleLab.numberOfLines = 0;
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.whiteV.mas_left).offset(15);
            make.right.equalTo(self.iconV.mas_left).offset(-5);
            make.top.equalTo(self.whiteV.mas_top).offset(15);
            make.bottom.equalTo(self.whiteV.mas_bottom).offset(-20);
        }];
        
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
